

package ru.athena.runTool.Parser;

import org.antlr.runtime.*;

public class CaseInsensitiveStringStream extends ANTLRStringStream {
    public CaseInsensitiveStringStream( char[] data, int numberOfActualCharsInArray) {
    	super(data, numberOfActualCharsInArray);
    }

    public CaseInsensitiveStringStream() {}

    public CaseInsensitiveStringStream(String input, String charset) {
    	super(input);
    }

     // Only the lookahead is converted to lowercase. The original 
    // case is preserved in the stream.
    @Override
    public int LA(int i) {
        if (i == 0) {
            return 0;
        }
        if (i < 0) {
            i++;
        }
        if (((p + i) - 1) >= n) {
            return (int) CharStream.EOF;
        }
        // This is how "case insensitive" is defined, i.e., could 
        // also use a special culture...
        return Character.toLowerCase(data[(p + i) - 1]);
    }
}
